(function (G) {
  window["components_AiEditor_AiEditor"]({
    "component": true,
    "usingComponents": {}
  }, {
    template: '#TEMPLATE_components_AiEditor_AiEditor',

    options: {
      multipleSlots: true
    },

    props: {
      // title: {
      //   type: String,
      //   default: '提示'
      // },
    },
    data () {
      return {
        env:'',
        visible:false,
        code:'',
        activeName:'code'
      }
    },
    methods: {
      async open(){
        this.visible = true
        let page = await G.get('/v1/page',{ hash: location.hash.replace('#',''),pathname: location.pathname })
        this.code = page.code
      },
      async submit(){
        let res = await G.put('/v1/page',{ code: this.code,hash: location.hash.replace('#',''),pathname: location.pathname })
        if(!res.errorMsg) {
          this.visible = false
          G.toask(res.message)
          location.reload()
        }
      }
    },
    mounted () {
      this.env = G.Storage.get('env')
    }
  });
})(Y);
